package com.lgy.controller;

import com.lgy.service.WebSocket;
import com.lgy.vo.ResultVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("test")
public class TestController extends BaseController{

    @Autowired
    private WebSocket webSocket;

    @Autowired
    private StringRedisTemplate redisTemplate;

    @GetMapping("/webSocketTest")
    public ResultVO webSocketTest() {
        webSocket.sendMessage("hello");
        return success();
    }

    @GetMapping("/redisTest")
    public ResultVO redisTest() {
        redisTemplate.opsForValue().set("a", "b");
        return success();
    }
}
